home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / sys_nerr.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  2.0 KB  |  67 lines

  1.  
  2.  
  3.  
  4. PERROR(3)           MINTLIB LIBRARY FUNCTIONS           PERROR(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        perror,  errno,  sys_errlist,  sys_nerr, strerror - system
  9.        error messages
  10.  
  11. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  12.        #include <stdio.h>
  13.  
  14.        void perror(const char *s);
  15.  
  16.        #include <errno.h>
  17.  
  18.        extern int errno;
  19.  
  20.        extern char *sys_errlist[];
  21.  
  22.        extern int sys_nerr;
  23.  
  24.        #include <string.h>
  25.  
  26.        char *strerror(int errnum);
  27.  
  28. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  29.        perror produces a message on the  standard  error  output,
  30.        describing  the  last error encountered during a call to a
  31.        system or library  function.  The  argument  string  s  is
  32.        printed  first, then a colon and a blank, then the message
  33.        and a new-line. (However, if s is NULL or s  is  an  empty
  34.        string  the  colon is not printed.) To be of most use, the
  35.        argument string should include the  name  of  the  program
  36.        that  incurred  the  error. The error number is taken from
  37.        the external variable errno,  which  is  set  when  errors
  38.        occur but not cleared when non-erroneous calls are made.
  39.  
  40.        To  simplify  variant formatting of messages, the array of
  41.        message strings sys_errlist is provided; errno can be used
  42.        as  an  index  into  this  table to get the message string
  43.        without the new-line.  sys_nerr is the number of  messages
  44.        in the table; it should be checked because new error codes
  45.        may be added to the system before they are  added  to  the
  46.        table.
  47.  
  48.        The  string  function  strerror takes an error code as its
  49.        argument and returns the corresponding message;  since  it
  50.        checks  sys_nerr,  it  may  be easier of safer to use than
  51.        sys_errlist.
  52.  
  53. N✓NO✓OT✓TE✓ES✓S
  54.        On UN*X, the string s may be empty, but may not always  be
  55.        NULL.
  56.  
  57.        Not  all  UN*X  or  POSIX error codes are supported by the
  58.        mintlibs.
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.